package com.invengo.module_check.ui.fragment.offline_collect.item;

import com.invengo.library_db.entity.module_check.BookBean;
import com.invengo.module_check.ui.fragment.offline_collect.OfflineCollectViewModel;

import androidx.annotation.NonNull;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

public class OfflineCollectItmeViewModel extends ItemViewModel<OfflineCollectViewModel> {

    public SingleLiveEvent<BookBean> bean =new SingleLiveEvent<>();
    public SingleLiveEvent<String> barCode =new SingleLiveEvent<>();

    public OfflineCollectItmeViewModel(@NonNull OfflineCollectViewModel viewModel,BookBean bean) {
        super(viewModel);
        this.bean.postValue(bean);

    }


    public BindingCommand removeItem = new BindingCommand(() -> {
        viewModel.onItemRemove(this);
    });


    public int getPosition() {
        return viewModel.getPosition(this) + 1;
    }
}
